home *** CD-ROM | disk | FTP | other *** search
- package
- {
- import flash.display.MovieClip;
- import flash.display.Sprite;
- import flash.events.Event;
-
- public class ObstacleManager extends Sprite
- {
-
-
- private var §\x01\x01\x02\t§:* = null;
-
- private var §\x01\x01\x06\x0b§:* = null;
-
- private var §\x01\x01\x02\r§:* = null;
-
- internal const OBTSPACEDEC:* = 0.3;
-
- internal const DOC_HEIGHT:* = 400;
-
- internal const OBTHEIGHT:* = 62.5;
-
- internal const OBTWIDTH:* = 60;
-
- public var theKnight:*;
-
- private var §\x01\x01\x06\r§:* = null;
-
- internal const DOC_TOP:* = 0;
-
- internal const OBTSPACE:* = 400;
-
- private var §\x01\x01\x06\x0f§:Number;
-
- private var §\x01\x01\x04\x0e§:Boolean = false;
-
- internal const OBTYPOS:* = 268.75;
-
- private var §\x01\x01\x03\x0e§:* = null;
-
- internal const DOC_WIDTH:* = 640;
-
- public var obstacleCount:int = 0;
-
- internal const DOC_LEFT:* = 0;
-
- internal const OBTCOUNTMAX:* = 200;
-
- private var §\x01\x01\x07\x01§:*;
-
- public var theDragon:*;
-
- internal const OBTFACECOUNT:* = 5 + 1;
-
- private var §\x01\x01\x07\x03§:Number;
-
- public function ObstacleManager(param1:*, param2:*, param3:*)
- {
- §\x01\x01\x04\x0e§ = false;
- §\x01\x01\x02\t§ = null;
- §\x01\x01\x02\r§ = null;
- §\x01\x01\x03\x0e§ = null;
- §\x01\x01\x06\r§ = null;
- §\x01\x01\x06\x0b§ = null;
- obstacleCount = 0;
- super();
- §\x01\x01\x02\t§ = param1;
- §\x01\x01\x02\r§ = param2;
- §\x01\x01\x03\x0e§ = param3;
- §\x01\x01\x06\r§ = §\x01\x01\x02\r§.GetSceneContainer();
- §\x01\x01\x07\x03§ = §\x01\x01\x02\r§.GetFrontScrollSpeed();
- }
-
- public function StopGame() : *
- {
- §\x01\x01\x06\x10§();
- §\x01\x01\x02\t§.removeEventListener(Event.ENTER_FRAME,§\x01\x01\x06\x0e§);
- }
-
- private function §\x01\x01\x06\f§() : *
- {
- var _loc1_:int = 0;
- if(theDragon.GetDragonStatus() == 0)
- {
- if(§\x01\x01\x06\x0b§ != null)
- {
- _loc1_ = §\x01\x01\x07\x02§();
- if(_loc1_ < OBTFACECOUNT)
- {
- §\x01\x01\x06\x0b§ = new obstacle();
- §\x01\x01\x06\x0b§.Init(§\x01\x01\x02\t§,§\x01\x01\x06\r§,this);
- §\x01\x01\x06\x0b§.x = 640;
- §\x01\x01\x06\x0b§.ShowFace(_loc1_);
- }
- else
- {
- §\x01\x01\x06\x0b§ = new bird();
- §\x01\x01\x06\x0b§.Init(§\x01\x01\x02\t§,§\x01\x01\x06\r§,this);
- §\x01\x01\x06\x0b§.x = 640;
- }
- §\x01\x01\x06\r§.addChild(§\x01\x01\x06\x0b§);
- --§\x01\x01\x06\x0f§;
- ++obstacleCount;
- }
- else
- {
- _loc1_ = 5;
- §\x01\x01\x06\x0b§ = new obstacle();
- §\x01\x01\x06\x0b§.Init(§\x01\x01\x02\t§,§\x01\x01\x06\r§,this);
- if(obstacleCount == 0)
- {
- §\x01\x01\x06\x0b§.x = 840;
- }
- else
- {
- §\x01\x01\x06\x0b§.x = 640;
- }
- §\x01\x01\x06\x0b§.ShowFace(_loc1_);
- §\x01\x01\x06\r§.addChild(§\x01\x01\x06\x0b§);
- --§\x01\x01\x06\x0f§;
- ++obstacleCount;
- }
- }
- }
-
- public function StartGame() : *
- {
- if(§\x01\x01\x03\x0e§.mainChar)
- {
- theKnight = §\x01\x01\x03\x0e§.mainChar;
- }
- if(§\x01\x01\x03\x0e§.enemyChar)
- {
- theDragon = §\x01\x01\x03\x0e§.enemyChar;
- }
- §\x01\x01\x06\x0f§ = OBTSPACE;
- obstacleCount = 0;
- §\x01\x01\x06\x0b§ = null;
- §\x01\x01\x02\t§.addEventListener(Event.ENTER_FRAME,§\x01\x01\x06\x0e§,false,0,true);
- }
-
- private function §\x01\x01\x06\x0e§(param1:Event) : *
- {
- if(obstacleCount < OBTCOUNTMAX)
- {
- if(!§\x01\x01\x06\x0b§)
- {
- §\x01\x01\x06\f§();
- }
- else if(§\x01\x01\x06\x0b§.x < DOC_WIDTH - §\x01\x01\x06\x0f§ || !§\x01\x01\x06\x0b§.GetLive())
- {
- §\x01\x01\x06\f§();
- }
- }
- else
- {
- §\x01\x01\x03\x0e§.StopGame(false);
- }
- }
-
- public function DestroyObstacle(param1:MovieClip) : *
- {
- if(§\x01\x01\x06\x0b§ == param1)
- {
- §\x01\x01\x06\x0b§ = null;
- }
- param1.Destroy();
- §\x01\x01\x06\r§.removeChild(param1);
- }
-
- private function §\x01\x01\x06\x10§() : *
- {
- var _loc1_:int = 0;
- _loc1_ = 0;
- while(_loc1_ < §\x01\x01\x06\r§.numChildren)
- {
- if(§\x01\x01\x06\r§.getChildAt(_loc1_).GetCharType == "obstacle" || §\x01\x01\x06\r§.getChildAt(_loc1_).GetCharType == "bird")
- {
- DestroyObstacle(§\x01\x01\x06\r§.getChildAt(_loc1_));
- }
- _loc1_++;
- }
- }
-
- private function §\x01\x01\x07\x02§() : int
- {
- var _loc1_:int = 0;
- var _loc2_:String = null;
- _loc1_ = 0;
- return int(Math.random() * OBTFACECOUNT + 1);
- }
- }
- }
-